package com.firstjianmo.uicustomviews;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import org.w3c.dom.Text;

public class NextActivity extends Activity {

    private TextView showInfo;
    private String message;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_next);

        if(null != getIntent()){
            message = getIntent().getStringExtra("message");
        }
        Log.e("message",message + "");
        showInfo = (TextView) findViewById(R.id.showinfo);

        Button titleEdit = (Button) findViewById(R.id.title_edit);
        titleEdit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                showInfo.setText(message);
            }
        });
    }

    public static void startActivity(Context context, String message){
        Intent intent = new Intent(context, NextActivity.class);
        intent.putExtra("message", message);
        context.startActivity(intent);
    }

}
